package dataBase;

import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
import java.util.Map;

public class UserPasswordSqlTable extends SqlTable {
	public UserPasswordSqlTable(String tableName,
			List<ColumnValue> schema, String engine) {
		super(tableName, schema, engine);
	}

	public boolean validatePassword(Statement stmt, String username, String password) throws SQLException {
		if ((stmt == null) || (username == null) || (password == null)){
			return false;
		}
		String passwordQuery = "SELECT * " +
							   "FROM UserPassword " +
							   "WHERE UID = \"" + username + "\" AND " + "Password = \"" + password + "\";";
		return stmt.executeQuery(passwordQuery).next(); // return false if there are no lines
	}
}
